#include "stdafx.h"

#include "CollectableManager.h"

namespace ETM
{
	CollectableManager::CollectableManager()
	{
		
	}

	void CollectableManager::Update(Player* player, float delta)
	{
		for(unsigned int i = 0; i < collectables.size(); i++)
		{
			collectables[i]->Update(*player, delta);

			if(collectables[i]->collected)
			{
				collectables.erase(collectables.begin() + i);
			}
		}
	}

	//TODO: only draw colls on screen
	void CollectableManager::Render(sf::RenderWindow& window)
	{
		for(unsigned int i = 0; i < collectables.size(); i++)
		{
			collectables[i]->Render(window);
		}
	}

	void CollectableManager::AddCollectable(Collectable* col)
	{
		col->Load();
		collectables.push_back(col);
	}
}